import request from '@/commons/libraries/request'
export default {
  async gets (page, pageSize) {
    try {
      const ret = await request('/car/serverrole/gets/', {
        page: page,
        pageSize: pageSize
      })
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  },
  async getCount () {
    try {
      const ret = await request('/car/serverrole/getCount/', {})
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  },
  async add (data) {
    try {
      const ret = await request('/car/serverrole/add', data)
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  },
  async get (id) {
    try {
      const ret = await request('/car/serverrole/get', {id: id})
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  },
  async edit (data) {
    try {
      const ret = await request('/car/serverrole/edit', data)
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  }
}
